package de.wbh.gwt.form.layouter.shared.activity;

import java.util.List;

import com.google.web.bindery.event.shared.Event;

import de.wbh.gwt.form.layouter.gwt.ui.view.widget.Field;

public class FieldsCreatedEvent extends Event<FieldsCreatedEvent.Handler> {

	public static interface Handler {

		void onFieldsCreated(List<Field> fields);
	}

	private static final Type<Handler> TYPE = new Type<FieldsCreatedEvent.Handler>();

	public static Type<Handler> getType() {
		return TYPE;
	}

	private final List<Field> fields;

	public FieldsCreatedEvent(List<Field> fields) {
		this.fields = fields;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.onFieldsCreated(this.fields);
	}

	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

	public List<Field> getFields() {
		return this.fields;
	}

}
